﻿using System.Windows.Controls;
using System.Windows.Media;
using AgFractal.Coloring;

namespace AgFractal.Controls.GradientEditor
{
    public partial class Thumb : UserControl
    {
        public Thumb()
        {
            // Required to initialize variables
            InitializeComponent();
        }

        internal void Move(double dx)
        {
            moveTransform.X = dx;
        }

        internal double GetX()
        {
            return moveTransform.X;
        }

        private ColorEntry _ColorEntry;
        public ColorEntry ColorEntry
        {
            get
            {
                return _ColorEntry;
            }
            set
            {
                _ColorEntry = value;
                SetColor(value.Color);
            }
        }

        internal void SetColor(Color color)
        {
            rect.Fill = new SolidColorBrush(color);
        }

        private bool isActive;
        public bool IsActive
        {
            get
            {
                return isActive;
            }
            set
            {
                isActive = value;
                if (isActive)
                    path.Fill = new SolidColorBrush(Colors.Black);
                else
                    path.Fill = new SolidColorBrush(Colors.White);
            }
        }
    }
}